import log from '@/utils/log';
import storys from '@/models/storys';
import storyWithproject from '@/models/storyWithproject';
import { asyncDeleteUnion } from '../projectWithenv/index';

async function deleteUseEnv(arr, i: number) {
  if (i >= arr.length) return;
  await asyncDeleteUnion(arr[i]);
  deleteUseEnv(arr, i + 1);
}
export default async (event: TapdStoryEventType) => {
  const { id, object_type: objectType, status }: TapdStoryEventType = event;
  // 判断是需求
  if (objectType !== 'story') {
    log.error('/api/tapd/fieldchange只处理需求', JSON.stringify(event));
    throw Error('这里只处理需求。');
  }

  await storys.updateAdd({ ...event }, { id });
};
